package com.starlight.flower_server.infrastructure;

/**
 * @Author yfy2001
 * @date 2023/4/4 14:02
 */
public enum Status {
    OK(1000,"成功！"),
    EXCEPTION(0,"异常！"),
    RECORD_NOT_FOUND(1004,"无法找到对应的记录！"),
    /**
     * 验证码异常
     */
    CAPTCHA_ERROR(2001,"验证码错误"),
    EXPIRED_CAPTCHA(2002,"验证码已失效！"),
    /**
     * 用户异常
     */
    USER_NOT_FOUND(3001,"用户不存在！"),
    USER_ALREADY_EXISTS(3001,"用户已经存在！"),
    INCORRECT_USERNAME_OR_PASSWORD(3001,"用户名或密码错误!"),
    USER_BANNED(3001,"此用户已经被封禁!"),
    USER_WITH_ORDER(3001,"用户有未完成订单!"),
    /**
     * 商品异常
     */
    ITEM_WITH_ORDER(4001,"该商品有处理订单!"),
    CART_NOT_FOUND(4002,"购物车不存在"),
    CART_CREATE_FAILED(4003,"购物车创建失败"),
    /**
     * 分类异常
     */
    CATEGORY_ERROR(4003,"分类异常"),
    /**
     * 订单异常
     */
    INVALID_ORDER_NUMBER(5001,"订单商品数量异常！"),
    INVALID_ORDER_STOCK(5001,"订单商品库存不足！"),
    INVALID_ORDER_DISCOUNT(5001,"折扣范围必须在0.5-1！"),
    INVALID_ORDER_ADDRESS(5001,"订单地址异常！"),
    /**
     * 权限异常
     */
    LOGIN_REQUIRED(6001,"请先登录后再进行操作!"),
    PERMISSION_DENIED(6001,"权限不足！"),
    INVALID_TOKEN(6001,"令牌已经失效！"),
    INVALID_ROLE(6001,"无效的权限值！"),
    /**
     * 请求异常
     */
    PARAMETER_ERROR(7001,"参数错误！"),
    /**
     * 文章评论异常
     */
    INVALID_ARTICLE_ID(8001,"文章id非法！"),
    ERROR(9999,"错误！");
    private final Integer code;
    private final String message;
    Status(Integer code,String message) {
        this.code = code;
        this.message = message;
    }
    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }
}
